Method and appratus for face recognition and computer readable storage medium

ABSTRACT

The present disclosure provides a method and an apparatus for face recognition and a computer readable storage medium. The method includes: inputting a to-be-recognized blurry face image into a generator of a trained generative adversarial network to obtain a to-be-recognized clear face image; inputting the to-be-recognized clear face image to the feature extraction network to obtain a facial feature of the to-be-recognized clear face image; matching the facial feature of the to-be-recognized clear face image with each user facial feature in a preset facial feature database to determine the user facial feature best matching the to-be-recognized clear face image as a target user facial feature; and determining a user associated with the target user facial feature as a recognition result. Through this solution, the accuracy of the recognition of blurry faces can be improved.

CROSS REFERENCE TO RELATED APPLICATIONS

The present disclosure claims priority to Chinese Patent Application No.202010776692.4, filed Aug. 5, 2020, which is hereby incorporated byreference herein as if set forth in its entirety.

BACKGROUND 1. Technical Field

The present disclosure relates to image processing technology, andparticularly to a method and an apparatus for face recognition as wellas a computer readable storage medium.

2. Description of Related Art

Face recognition technology is currently widely used in the technologyof security monitoring and identity authentication. However, the currentgenerative adversarial network (GAN) based face deblurring methods onlyimprove the quality of the blurry face with the clarity and intuitiveexperience, while ignore the unique features of the blurry face. As aresult, the accuracy of blurry face recognition is still low.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical schemes in the embodiments of the presentdisclosure or in the prior art more clearly, the following brieflyintroduces the drawings required for describing the embodiments or theprior art. It should be understood that, the drawings in the followingdescription merely show some embodiments of the present disclosure. Forthose skilled in the art, other drawings can be obtained according tothe drawings without creative efforts.

FIG. 1 is a flow chart of a face recognition method according to anembodiment of the present disclosure.

FIG. 2 is a flow chart of training a generative adversarial networkaccording to an embodiment of the present disclosure.

FIG. 3 is a schematic diagram of an example of the operation of agenerator according to an embodiment of the present disclosure.

FIG. 4 is a schematic diagram of training a generative adversarialnetwork according to an embodiment of the present disclosure.

FIG. 5 is a flow chart of constructing a clear-blurry face image setaccording to an embodiment of the present disclosure.

FIG. 6 is a schematic diagram showing the duplicate of the number of theface images when forming a clear-blurry face image set according to anembodiment of the present disclosure.

FIG. 7 is a schematic block diagram of a face recognition apparatusaccording to an embodiment of the present disclosure.

FIG. 8 is a schematic block diagram of an electronic device according toan embodiment of the present disclosure.

DETAILED DESCRIPTION

In the following descriptions, for purposes of explanation instead oflimitation, specific details such as particular system architecture andtechnique are set forth in order to provide a thorough understanding ofembodiments of the present disclosure. However, it will be apparent tothose skilled in the art that the present disclosure may be implementedin other embodiments that are less specific of these details. In otherinstances, detailed descriptions of well-known systems, devices,circuits, and methods are omitted so as not to obscure the descriptionof the present disclosure with unnecessary detail.

For the purpose of describing the technical solutions of the presentdisclosure, the following describes through specific embodiments.

The following describes a face recognition method provided by anembodiment of the present disclosure. FIG. 1 is a flow chart of a facerecognition method according to an embodiment of the present disclosure.In this embodiment, a face recognition method is provided. The method isa computer-implemented method executable for a processor, which may beimplemented in a face recognition apparatus as shown in FIG. 7 or anelectronic device as shown in FIG. 8. As shown in FIG. 1, the facerecognition method includes the following steps.

101: inputting a to-be-recognized blurry face image into a generator ofa trained generative adversarial network to obtain a to-be-recognizedclear face image.

In this embodiment, the method is executed by an electronic device(e.g., a mobile phone, a tablet computer, a notebook computer, or adesktop computer) having a camera, and at least a part of its relateddata (e.g., instructions for implementing the method and temporary filegenerated during executing the method, and the input to-be-recognizedblurry face image) is stored in the electronic device. Theto-be-recognized blurry face image is input through the camera. Theelectronic device can train the generative adversarial network based ona preset clear-blurry face image set and a trained feature extractionnetwork in advance. The generative adversarial network includes agenerator and a discriminator. In which, the generator includes a keypoint detection encoder and a decoder. The key point detection encoderis for detecting key points of the blurry face image inputted to thegenerator. During training the generative adversarial network, thegenerative adversarial network will be coupled to the trained featureextraction network so that, for example, an output of the generator iscoupled to each of an input of the discriminator and an input of thetrained feature extraction network, that is, the output of the generatorcan not only be input to the discriminator for discrimination, but alsocan be input to the feature extraction network for feature extractions.The loss of the discrimination is merely associated with adiscrimination result of the discriminator, while the loss of thegenerator is not only merely associated with discrimination result ofthe discriminator but is also associated with the key point detectionresult of the key point detection encoder and a feature extractionresult of the feature extraction network. Based on the loss of thediscriminator and the loss of the generator, the generator and thediscriminator can be continuously optimized. After the generativeadversarial network trained, only the generator is put into use, and thediscriminator can be discarded. That is, in this embodiment, only thegenerator of the generative adversarial network is actually put intouse. The generator can deblur the input to-be-recognized blurry faceimage to obtain the to-be-recognized clear face image that retainsfacial features.

In some embodiments, in the case that the electronic device has capturedan image of a to-be-recognized face through the camera, it can firstdetect the quality of the image of the to-be-recognized face based on apreset quality detection model to determine whether the image of theto-be-recognized face is blurry. If the image of the to-be-recognizedface is blurry, the image of the to-be-recognized face is determined asthe to-be-recognized blurry face image, and step 101 and subsequentsteps are executed. As an example only, the quality detection model canuse a blur detection algorithms such as Brenner gradient function,Tenengrad gradient function, or Laplacian gradient function to determinewhether the image of the to-be-recognized face is blurry, which is notlimited herein.

In one embodiment, the clear-blurry face image set is a training sampleof the generative adversarial network. In which, the clear-blurry faceimage set includes a plurality of clear-blurry face image pairs, whereeach clear-blurry face image pair includes a clear face image and ablurry face image, and the difference between the clear face image andthe blurry face image is only in their blur degree.

In one embodiment, the feature extraction network is for extractingfacial features, and is composed of a convolutional neural network(CNN). Unlike traditional feature extraction methods such as histogramof oriented gradient (HOG) and scale-invariant feature transform (SIFT),the CNN can extract global features that are not easy to be discoveredby humans.

In an example, the training method of the above-mentioned featureextraction network includes steps of: taking a clear face image as atraining sample, where the size of the face contained in the clear faceimage is a preset size such as 128*128 pixels, and the upper-lower rangeof the face included in the clear face image is from the chin to the topof the forehead, and the left-right range of the face include at leastboth ears; and training the feature extraction network as aclassification network. In which, each person is an independentcategory. For example, if there are 3 clear face images of person 1,these 3 clear face images belong to the category of person 1; and ifthere are 5 clear face images of person 2, these 5 clear face imagesbelong to the category of person 2. After the training is completed, thesoftmax classification layer that is in the last layer is removed whilethe fully connected layer in the second last layer is retained, then theoutput of the fully connected layer is the facial feature extracted bythe feature extraction network, where the form of the facial feature isa feature vector.

It should be noted that, the training sample used by the featureextraction network is not the clear face image in the above-mentionedclear-blurry face image set that composes the clear-blurry face imagepair, but is the clear face image obtained from otherwise. That is, thetraining sample of the feature extraction network is different from thetraining sample of the generative adversarial network.

102: inputting the to-be-recognized clear face image to the featureextraction network to obtain a facial feature of the to-be-recognizedclear face image.

In this embodiment, the to-be-recognized clear face image output by thegenerator will be input into the feature extraction network. That is,after the trained feature extraction network is obtained, the featureextraction network can not only be used to train the generativeadversarial network (that is, used in the training process of thegenerative adversarial network), but also can be used to extract thefacial feature of the to-be-recognized clear face image (that is, usedin the application process of the generative adversarial network).

103: matching the facial feature of the to-be-recognized clear faceimage with each user facial feature in a preset facial feature databaseto determine the user facial feature best matching the to-be-recognizedclear face image as a target user facial feature.

In this embodiment, the electronic device can have a facial featuredatabase stored in advance locally or in the cloud server, where thefacial feature database stores the user facial feature of eachregistered user.

In an example, one registered user corresponds to only one user facialfeature in the facial feature database. The electronic device can matchthe facial feature of the to-be-recognized clear face image with eachuser facial feature in the facial feature database, and the result ofthe matching can be represented as similarity. Thus, the user facialfeature that best matches the to-be-recognized clear face image, thatis, the user facial feature with the highest similarity, can beobtained, and the user facial feature can be determined as the targetuser facial feature.

In an example, the construction process of the above-mentioned facialfeature database is as follows. The electronic device can first obtainthe user face image of each registered user, and then input each userface image to the trained feature extraction network (that is, thefeature extraction network in step 102) to obtain the user facialfeature of each user, thereby constructing the facial feature database.

In an example, the result of the matching can be represented throughcosine similarity, and the electronic device can calculate the cosinesimilarity between the facial feature of the to-be-recognized clear faceimage and each user facial feature and determine that the higher thecosine similarity, the higher the matchingness. Finally, the obtaineduser facial feature corresponding to the highest cosine similarity isthe user facial feature that best matches the to-be-recognized clearface image, and the user facial feature can be determined as the targetuser facial feature.

In one embodiment, to avoid misrecognition, the electronic device canalso set a cosine similarity threshold in advance. For example, thecosine similarity threshold may be set to 0.75. The highest cosinesimilarity will be determined as qualified and the corresponding userfacial feature can exactly match the to-be-recognized clear face imageonly when the calculated highest cosine similarity is larger than thecosine similarity threshold. Otherwise, if the cosine similarity is lessthan or equal to the cosine similarity threshold, it is determined thatthe highest cosine similarity is not qualified, and the correspondinguser facial feature does not match the to-be-recognized clear faceimage. For example, assuming that the calculated maximum cosinesimilarity is 0.2, it is obviously far less than the set cosinesimilarity threshold of 0.75, which means that the to-be-recognizedclear face image is not the image of the face of any registered user.Therefore, when the calculated maximum cosine similarity is less than orequal to the above-mentioned cosine similarity threshold, a rejectionmessage can be output. The rejection message is for indicating that theto-be-recognized blurry face is the face of an illegal user (that is, anon-registered user), and the subsequent operations to be performed canbe determined according to the application scenario. For example, in theapplication scenario of employee check-in, it can prompt the specifieduser (e.g., a user from the personnel department) whether to enter theuser registration process after outputting the rejection message; in theapplication scenario of security monitoring, it can trigger a buzzer toalarm after outputting the rejection message so as to remind that theremay be an illegal user trying to break in and a certain security risk isposed.

104: determining a user associated with the target user facial featureas a recognition result.

In this embodiment, since each user facial feature is uniquelyassociated with a registered user, the user associated with theabove-mentioned target user facial feature can be determined as therecognition result; that is, the to-be-recognized blurry face can bedetermined as the face of the user.

It should be noted that, in this embodiment, the feature extractionnetwork used in the training phase and application phase of thegenerative adversarial network is the same feature extraction networkthat has been trained, that is, the feature extraction network in step101 and step 102 is the same feature extraction network that has beentrained.

FIG. 2 is a flow chart of training a generative adversarial networkaccording to an embodiment of the present disclosure. As shown in FIG.2, in this embodiment, before executing the face recognition methodshown in FIG. 1, the step of training the generative adversarial networkbased on each clear-blurry face image pair in the above-mentionedclear-blurry face image set includes the following steps.

201: inputting the blurry face image in each of the clear-blurry faceimage pairs in the clear-blurry face image set to a generator of ato-be-trained generative adversarial network to obtain the key points ofthe blurry face image and a generated clear face image.

In this embodiment, the key point detection encoder in the generator isa face key point detection network which can be used to detect 68 orother number of key points of the input face image.

For the face key point detection network, it can be trainedindependently in advance using the clear face image and the truth valueof the key points of each clear face image. In which, the size of theface contained in the clear face image used when training the face keypoint detection network is a preset size such as 128*128 pixels, and theupper-lower range of the face contained in the clear face image is fromthe chin to the top of the forehead while the left-right range of theface at least includes both ears. It should be noted that, the trainingsample used by the face key point detection network is not the clearface image in the above-mentioned clear-blurry face image set, but theclear face images obtained from otherwise. That is, the training sampleof the face key point detection network is different from the trainingsample of the generative adversarial network. After the pre-training ofthe face key point detection network is completed, the parameters of theface key point detection network are retained, the initial key pointdetection encoder is obtained, and the training of the generativeadversarial network is started. That is, the pre-trained face key pointdetection network can be used as the key point detection encoder whenstarts training the generative adversarial network.

For ease of description, the face image input to the key point detectionencoder can be denoted as x, then the output obtained by the key pointdetection encoder based on x can be denoted as key points G₁(x), wherethe output is a batchsize×1×128×128 matrix. In the matrix, the positionvalues corresponding to the detected key points are 1, and the remainingposition values are 0.

After obtaining the output obtained by the key point detection encoderbased on the blurry face image, the output is combined with thecorresponding blurry face image. That is, the blurry face image and itskey points are combined, and the result of combination will be input tothe decoder. The decoder can decode the result of combination, and theoutput of the decoder is the clear face image corresponding to theblurry face image input to the generator. In this embodiment, since theclear face image is generated by the generator, in order to distinguishit from the clear face image corresponding to the blurry face image inthe clear-blurry face image pair, the clear face image generated by thegenerator based on the blurry face image is referred to as the generatedclear face image G(x). FIG. 3 is a schematic diagram of an example ofthe operation of a generator according to an embodiment of the presentdisclosure. Referring to FIG. 3, the process of the generator to obtaina corresponding generated clear face image G(x) based on a blurry faceimage x is shown.

In an example, during training, the value of batchsize is 1. That is,the number of the face images input to the generator each time is 1. Forexample, the blurry face image x may be a 1×3×128×128 matrix, where 3 isused to represent the RGB three channels of the blurry face image, and128×128 is used to represent the size of the blurry face image x.Correspondingly, the key points G₁(x) of the blurry face image output bythe key point detection encoder is a 1×1×128×128 matrix. The result ofthe combination of the two is a 1×4×128×128 matrix which will be inputto the decoder for decoding, so as to obtain the output result G(x) ofthe decoder.

202: inputting each of the generated clear face image and the clear faceimage corresponding to the blurry face image to the discriminator of theto-be-trained generative adversarial network to obtain a discriminationresult of the discriminator.

In this embodiment, the discriminator is configured to performclassification tasks, which distinguishes that the input clear faceimage is a real clear face image (i.e., the clear face image stored inthe clear-blurry face image set) or a clear face image generated by thegenerator (i.e., the generated clear face image). Based on this, theinput data of the discriminator of the generative adversarial networkduring training is the generated clear face image output by thegenerator based on a blurry face image, and the clear face imagecorresponding to the blurry face image in the clear-blurry face imageset.

203: calculating a loss of the discriminator based on the discriminationresult.

In this embodiment, after the discriminator outputs the discriminationresult, the loss of the discriminator can be calculated based on thediscrimination result, where the true value of the generated clear faceimage output by the generator based on a blurry face image is 0, and thetruth value of the clear face image corresponding to the blurry faceimage in the clear-blurry face image set is 1. The above-mentioned lossof the discriminator is actually the cross entropy of the classificationtask it performs, which can be denoted as L_(D).

204: inputting the generated clear face image to the feature extractionnetwork to obtain a feature extraction result of the generated clearface image.

In this embodiment, in addition to being input to the discriminator, thegenerated clear face image is also input to the trained featureextraction network which is the feature extraction network in step 102.Through the feature extraction network, the feature extraction result ofthe above-mentioned generated clear face image can be obtained. Itshould be noted that, in this embodiment, the order of the execution ofstep 204 and step 202 will not be limited.

205: inputting the clear face image to the key point detection encoderof the generator and the feature extraction network, respectively, toobtain key points of the clear face image and the feature extractionresults of the clear face image.

In this embodiment, the clear face image (that is, the real clear faceimage) corresponding to the above-mentioned blurry face image is notonly input to the discriminator, but also input to the generator and thefeature extraction network. Correspondingly, the key points of the clearface image that are output by the key point detection encoder of thegenerator and the feature extraction result of the clear face imageoutput by the feature extraction network can be obtained. It should benoted that, in this embodiment, the order of the execution of step 205and step 201 will not be limited.

206: calculating the loss of the generator based on the key points ofthe blurry face image, the key points of the clear face image, thefeature extraction result of the generated clear face image, the featureextraction result of the clear face image, and the discriminationresult.

In this embodiment, the key points of the blurry face image and the keypoints of the corresponding clear face image can be used to calculatethe loss L_(Landmark) of the key point detection encoder. Thecalculation process includes steps of: calculating an average distancebetween each key point of the blurry face image and a corresponding keypoint of the clear face image, and taking the average distance as theloss L_(Landmark). That is, the loss L_(Landmark)=(D_(1-1′)+D_(2-2′)+ .. . +D_(68-68′))÷68, where D_(i-i′) refers to the distance between thei-th key point of the blurry face image and the i-th key point of thecorresponding clear face image, where i=1, 2, 3, . . . , and 68.

Considering that the generated clear face image is an image generatedbased on a blurry face image, while the clear face image is a real imagecorresponding to the blurry face image, the feature extraction result ofthe generated clear face image and the feature extraction result of theclear face image can be used to calculate the loss L_(Feature) betweenthe features of the two images through steps of: calculating a featureloss value between the feature extraction result of the generated clearface image and the feature extraction result of the above-mentionedclear face image based on the quadratic loss function (i.e., the L2loss) of the feature extraction network, and taking the feature lossvalue as the loss L_(Feature).

The discrimination result can be used to calculate the cross entropy ofthe discriminator so as to obtain the loss L_(D) of the discriminator.

Finally, the loss L_(G) of the generator can be expressed as:L _(G) =L _(D) +αL _(Feature) +βL _(Landmark);

where, α and β are both hyperparameters.

207: optimizing the discriminator based on the loss of thediscriminator, and optimizing the generator based on the loss of thegenerator until the loss of the generator converges so as to obtain thetrained generative adversarial network.

In this embodiment, the discriminator can be optimized based on the lossof the discriminator; at the same time, the generator can be optimizedbased on the loss of the generator, to be specifically, optimizing thekey point detection encoder of the generator. The sign of the completionof training is that the loss L_(G) has reached convergence. That is, ifthe calculated loss L_(G) is less than a preset loss threshold, thetraining of the generative adversarial network is considered to becompleted, the training can be ended, then the generator at this timecan be put into use, and then step 101 and subsequent steps can be startto execute.

It should be noted that, before training the generative adversarialnetwork, a maximum training round can be set. In this embodiment, theinitial training round “epoch” is 0. If one round of training hascompleted based on all the clear-blurry face image pairs in theclear-blurry face image set, the training round epoch is increased by 1;and if the round epoch reaches the maximum training round or thetraining round epoch does not reach the maximum training round but theloss L_(G) is already less than the preset loss threshold, the trainingis ended.

FIG. 4 is a schematic diagram of training a generative adversarialnetwork according to an embodiment of the present disclosure. Referringto FIG. 4, the process of training the generative adversarial networkwill be shown using a clear-blurry face image pair:

The clear face image in the clear-blurry face image pair is denoted asc, and the blurry face image is denoted as b. The dotted lines in FIG. 4are all operations associated with the clear face image c.

First, the electronic device can respectively input the clear face imagec and the blurry face image b into the key point detection encoder ofthe generator to obtain key points G₁(c) output by the key pointdetection encoder based on the clear face image c and key points G₁(b)output based on the blurry face image b, and calculate the averagedistance L_(Landmark) between the key points corresponding to the keypoints G₁(c) and the key points G₁(b).

Then, the electronic device combines the blurry face image b and the keypoints G₁(b) to input to the decoder so as to obtain a generated clearface image G(b) output by the decoder. The generated clear face imageG(b) and the clear face image c are input into the discriminator, andthe cross-entropy L_(D) of the classification task of the discriminatorcan be calculated based on the discrimination result of thediscriminator. The electronic device can optimize the discriminatorbased on the cross-entropy L_(D).

In addition, the electronic device further respectively inputs thegenerated clear face image G(b) and the clear face image c into thetrained feature extraction network to obtain the facial featureE_(f)(G(b)) of the generated clear face image G(b) output by the featureextraction network and the facial feature E_(f)(c) of the clear faceimage c so as to calculate the loss L_(Feature) based thereon, where theloss L_(Feature) is the L2 loss of the facial feature E_(f)(G(b)) andthe facial feature E_(f)(c).

Finally, the loss L_(G) of the generator is calculated based on theformula of L_(G)=L_(D)+αL_(Feature)+βL_(Landmark). The electronic devicecan optimize the generator based on the loss L_(G).

It should be noted that, the generative adversarial network is trainedby the above-mentioned process based on each clear-blurry face imagepair in the clear-blurry face image set to realize continuousoptimization of the generator and discriminator until the training iscompleted.

FIG. 5 is a flow chart of constructing a clear-blurry face image setaccording to an embodiment of the present disclosure. As shown in FIG.5, in this embodiment, before training the generative adversarialnetwork, the construction of the clear-blurry face image set includesthe following steps.

501: obtaining a sample image containing a clear face.

In this embodiment, considering that it is difficult to collect theblurry image, while the clear image corresponding to the blurry imageneeds to be obtained, that is, the difference between the two images ina clear-blurry image pair is only the degree of blur, which is difficultto achieve directly through collection. Therefore, the blurry image isobtained by generating based on the clear image. The electronic devicecan first obtain a large number of sample images containing clear facescollected by different devices having a camera (e.g., smart phone andwebcam), and the size of these sample images can be different.

502: cropping the sample image based on the clear face to obtain a firstface image, where the size of the first face image is larger than apreset size.

In this embodiment, the sample image is cropped to crop out the clearface contained in the sample image. The clear face refers to an areawhere a face having the upper-lower range from the chin to the top ofthe forehead and the left-right range including at least both ears islocated, which can be a square. After the cropping, the electronicdevice can detect the size of the retained face image, and remove theface image whose size is less than or equal to the preset size. Afterthe removal, the retained face image can be denoted as the first faceimage. As an example, the above-mentioned preset size may be 128*128pixels.

503: reducing the first face image based on a preset interpolationalgorithm to obtain a second face image, where the size of the secondface image is equal to the preset size.

In this embodiment, the electronic device can use the “resize” functionof OpenCV to reduce each first face image based on a presetinterpolation algorithm. It should be noted that, in order to enrich thedata, a variety of interpolation algorithms can be used to respectivelyreduce each first face image. For example, five algorithms of nearestneighbor interpolation, bilinear interpolation, resampling using pixelregion relations, bicubic interpolation in 4×4 pixels neighborhoods, andLanczos interpolation in 8×8 pixels neighborhoods can be used to reduceeach first face image. That is, a first face image can be processed fivetimes to obtain 5 corresponding second face images, thereby realizingthe replicate of the number of face images. It should be noted that, thesize of each second face image obtained in this step is equal to thepreset size.

504: reducing the second face image based on the interpolation algorithmto obtain a third face image, where the size of the third face image issmaller than the preset size.

In this embodiment, the electronic device can continue to use the resizefunction of OpenCV to reduce each second face image based on the presetinterpolation algorithm. It should be noted that, in order to enrich thedata, a variety of interpolation algorithms can be used to reduce eachsecond face image. Furthermore, one interpolation algorithm can beapplied to the same second face image multiple times so that a pluralityof third face images of different sizes (that is, different reductionmultiples) can be obtained based on an interpolation algorithm throughone second face image. For example, five algorithms of nearest neighborinterpolation, bilinear interpolation, resampling using pixel regionrelations, bicubic interpolation in 4×4 pixels neighborhoods, andLanczos interpolation in 8×8 pixels neighborhoods can be used to reduceeach second face image, and each interpolation algorithm cancorrespondingly reduce by 3, 4, 6, and 8 times to obtain the third faceimage of 43*43 pixels, 32*32 pixels, 21*21 pixels, and 16*16 pixels.That is, a second face image can be reduced by five interpolationalgorithms, respectively, and each interpolation algorithm can outputfour corresponding third face images of different sizes during reducing.In this way, through this step, one second face image can be used toobtain 20 corresponding third face images, thereby realizing theduplicate of the number of images. It should be noted that, the size ofeach third face image obtained in this step is smaller than the presetsize.

505: enlarging the third face image based on the interpolation algorithmto obtain a fourth face image, where the size of the fourth face imageis equal to the preset size.

In this embodiment, the electronic device can continue to use the resizefunction of OpenCV to reduce each third face image based on the presetinterpolation algorithm. It should be noted that, in order to enrich thedata, a variety of interpolation algorithms can be used to enlarge eachthird face image. For example, five algorithms of nearest neighborinterpolation, bilinear interpolation, resampling using pixel regionrelations, bicubic interpolation in 4×4 pixels neighborhoods, andLanczos interpolation in 8×8 pixels neighborhoods can be used to enlargeeach third face image. That is, a third face image can be processed fivetimes to obtain 5 corresponding fourth face images, thereby realizingthe duplicate of the number of images. It should be noted that, the sizeof each fourth face image obtained in this step is equal to the presetsize.

506: forming the clear-blurry face image pair based on the second faceimage and the fourth face image to construct the clear-blurry face imageset.

In this embodiment, the second face image is a clear face image with thepreset size, and the fourth face image is a blur face image with thepreset size. After a second face image is processed in step 504, 20third face images can be obtained correspondingly. After each third faceimage is processed in step 505, 5 fourth face images can be obtainedcorrespondingly. Then, 100 (that is, 20*5) fourth face images canfinally be obtained through one second face image. That is, each secondface image can form 100 clear-blur face image pairs with thecorresponding 100 fourth face images, so as to realize the constructionof the clear-blur face image set.

FIG. 6 is a schematic diagram showing the duplicate of the number of theface images when forming a clear-blurry face image set according to anembodiment of the present disclosure. Referring to FIG. 6, the duplicateof the number of the face images in the above-mentioned steps 501-506 isshown. Due to space limitations, not all of the images are shown. It canbe seen that, through the above-mentioned steps 501-506, a large numberof training samples that can be used to train the generative adversarialnetwork can be quickly obtained, so as to construct the clear-blurryface image set. In which, the first face image is transformed into thesecond face image, and the times of the duplicate of the number is 5;the second face image is transformed into the third face image, and thetimes of the duplicate of the number is 20; the third face image istransformed into the fourth face image, the times of the duplicate ofthe number is still 5. That is, for a sample image containing a clearface, 500 fourth face images can be finally obtained, that is, 500clear-blurry face image pairs can be finally obtained.

It should be noted that, the preset interpolation algorithm used in theabove-mentioned process is not limited to the five algorithms of nearestneighbor interpolation, bilinear interpolation, resampling using pixelregion relations, bicubic interpolation in 4×4 pixels neighborhoods, andLanczos interpolation in 8×8 pixels neighborhoods, and the electronicdevice can select other interpolation algorithms to scale the faceimages according to the needs. In addition, the electronic device canalso use fewer or more interpolation algorithms to scale the faceimages, which is not limited herein.

It can be seen from the forgoing that, through this embodiment, thegenerative adversarial network pays attention to the facial feature ofthe blurry facial images during training, so that the deblurring processand the recognition process can be organically combined. When thegenerator of the trained generative adversarial network is put into use,the to-be-recognized clear face image generated by the generator basedon the to-be-recognized blurry face can retain the unique featureinformation of the face, which can improve the accuracy of the facerecognition for the to-be-recognized clear face image to a certainextent.

It should be understood that, the sequence of the serial number of thesteps in the above-mentioned embodiments does not mean the executionorder while the execution order of each process should be determined byits function and internal logic, which should not be taken as anylimitation to the implementation process of the embodiments.

Corresponding to the above-mentioned face recognition method, anembodiment of the present disclosure also provides a face recognitionapparatus. FIG. 7 is a schematic block diagram of a face recognitionapparatus according to an embodiment of the present disclosure. Theabove-mentioned face recognition apparatus can be integrated into anelectronic device having a camera such as an electronic device as shownin FIG. 8. Referring to FIG. 7, in this embodiment, a face recognitionapparatus 700 includes:

a blurry removing unit 701 configured to input a to-be-recognized blurryface image into a generator of a trained generative adversarial networkto obtain a to-be-recognized clear face image, where a training sampleof the generative adversarial network is obtained from a presetclear-blurry face image set, the clear-blurry face image set includesone or more clear-blurry face image pairs, the generator is composed ofa key point detection encoder and a decoder, and the key point detectionencoder is for detecting key points of the blurry face image inputted tothe generator; where during training the generative adversarial network,an output of the generator is coupled to each of an input of adiscriminator of the generative adversarial network and an input of atrained feature extraction network, and a loss of the generator isassociated with the key point detection encoder, the feature extractionnetwork, and the discriminator;

a feature extracting unit 702 configured to input the to-be-recognizedclear face image to the feature extraction network to obtain a facialfeature of the to-be-recognized clear face image;

a feature matching unit 703 configured to match the facial feature ofthe to-be-recognized clear face image with each user facial feature in apreset facial feature database to determine the user facial feature bestmatching the to-be-recognized clear face image as a target user facialfeature; and

a result determining unit 704 configured to determine a user associatedwith the target user facial feature as a recognition result.

In one embodiment, the above-mentioned face recognition apparatus 700further includes:

a first obtaining unit configured to input the blurry face image in eachof the clear-blurry face image pairs in the clear-blurry face image setto a generator of a to-be-trained generative adversarial network toobtain the key points of the blurry face image and a generated clearface image;

a second obtaining unit configured to input each of the generated clearface image and the clear face image corresponding to the blurry faceimage to the discriminator of the to-be-trained generative adversarialnetwork to obtain a discrimination result of the discriminator;

a third acquiring unit configured to input the generated clear faceimage to the feature extraction network to obtain a feature extractionresult of the generated clear face image;

a fourth obtaining unit configured to input the clear face image to thekey point detection encoder of the generator and the feature extractionnetwork, respectively, to obtain key points of the clear face image andthe feature extraction results of the clear face image;

a discriminator loss calculating unit configured to calculate a loss ofthe discriminator based on the discrimination result;

a generator loss calculating unit configured to calculate the loss ofthe generator based on the key points of the blurry face image, the keypoints of the clear face image, the feature extraction result of thegenerated clear face image, the feature extraction result of the clearface image, and the discrimination result; and

an optimization unit configured to optimize the discriminator based onthe loss of the discriminator, and optimize the generator based on theloss of the generator until the loss of the generator converges so as toobtain the trained generative adversarial network.

In one embodiment, the generator loss calculating unit includes:

a first calculating subunit configured to calculate an average distancebetween each key point of the blurry face image and a corresponding keypoint of the clear face image;

a second calculating subunit configured to calculate a feature lossvalue between the feature extraction result of the generated clear faceimage and the feature extraction result of the clear face image based ona loss function of the feature extraction network;

a third calculating subunit configured to calculate a cross entropy ofthe discriminator based on the discrimination result; and

a fourth calculating subunit configured to calculate the loss of thegenerator based on the average distance, the feature loss value, and thecross entropy.

In one embodiment, the above-mentioned face recognition apparatus 700further includes:

a sample image obtaining unit configured to obtain a sample imagecontaining a clear face;

a sample image cropping unit configured to crop the sample image basedon the clear face to obtain a first face image, where the size of thefirst face image is larger than a preset size;

a first image reducing unit configured to reduce the first face imagebased on a preset interpolation algorithm to obtain a second face image,where the size of the second face image is equal to the preset size;

a second image reducing unit configured to reduce the second face imagebased on the interpolation algorithm to obtain a third face image, wherethe size of the third face image is smaller than the preset size;

an image enlarging unit configured to enlarge the third face image basedon the interpolation algorithm to obtain a fourth face image, where thesize of the fourth face image is equal to the preset size; and

an image pair forming unit configured to form the clear-blurry faceimage pair based on the second face image and the fourth face image toconstruct the clear-blurry face image set.

In one embodiment, the above-mentioned face recognition apparatus 700further includes:

a user face image obtaining unit configured to obtain a user face imageof each user; and

a user facial feature extracting unit configured to input each user faceimage to the feature extraction network to obtain the user facialfeature of each user to construct the facial feature database.

In one embodiment, the above-mentioned feature matching unit 703includes:

a cosine similarity calculating subunit configured to calculate a cosinesimilarity between the facial feature of the to-be-recognized clear faceimage and each user facial feature; and

a target user facial feature determining subunit configured to determinethe user facial feature corresponding to calculated highest cosinesimilarity as the target user facial feature.

In some embodiments, the blurry removing unit 701 is further configuredto capture an image of a to-be-recognized face through a camera of theface recognition apparatus 700; detect the quality of the captured imagebased on a preset quality detection model to determine whether thecaptured image is blurry; and determine the captured image as theto-be-recognized blurry face image, in response to the captured imagebeing blurry. In one embodiment, the above-mentioned target user facialfeature determining subunit is configured to compare the highest cosinesimilarity with a preset cosine similarity threshold; and determine theuser facial feature corresponding to the highest cosine similarity asthe target user facial feature, in response to the highest cosinesimilarity being greater than the cosine similarity threshold.

It can be seen from the forgoing that, through this embodiment, thegenerative adversarial network pays attention to the facial feature ofthe blurry facial images during training, so that the deblurring processand the recognition process can be organically combined. When thegenerator of the trained generative adversarial network is put into use,the to-be-recognized clear face image generated by the generator basedon the to-be-recognized blurry face can retain the unique featureinformation of the face, which can improve the accuracy of the facerecognition for the to-be-recognized clear face image to a certainextent.

Corresponding to the above-mentioned face recognition method, anembodiment of the present disclosure also provides an electronic device.FIG. 8 is a schematic block diagram of an electronic device according toan embodiment of the present disclosure. Referring to FIG. 8, in thisembodiment, an electronic device 8 includes a storage 801, one or moreprocessors 802 (only one shown in FIG. 8), a computer program stored inthe storage 801 and executable on the processor, and a camera. Thestorage 801 is configured to store software programs and modules, andthe processor 802 performs various functions and data processing byexecuting the software programs and units stored in the storage 801 soas to obtain resources corresponding to preset events. Specifically, theprocessor 802 implements the following steps when executing theforegoing computer program stored in the storage 801:

inputting a to-be-recognized blurry face image into a generator of atrained generative adversarial network to obtain a to-be-recognizedclear face image, where a training sample of the generative adversarialnetwork is obtained from a preset clear-blurry face image set, theclear-blurry face image set includes one or more clear-blurry face imagepairs, the generator is composed of a key point detection encoder and adecoder, and the key point detection encoder is for detecting key pointsof the blurry face image inputted to the generator; where duringtraining the generative adversarial network, an output of the generatoris coupled to each of an input of a discriminator of the generativeadversarial network and an input of a trained feature extractionnetwork, and a loss of the generator is associated with the key pointdetection encoder, the feature extraction network, and thediscriminator;

inputting the to-be-recognized clear face image to the featureextraction network to obtain a facial feature of the to-be-recognizedclear face image;

matching the facial feature of the to-be-recognized clear face imagewith each user facial feature in a preset facial feature database todetermine the user facial feature best matching the to-be-recognizedclear face image as a target user facial feature; and

determining a user associated with the target user facial feature as arecognition result.

In some embodiments, the processor 802 further implements the followingsteps: capturing an image of a to-be-recognized face through the camera;detecting the quality of the captured image based on a preset qualitydetection model to determine whether the captured image is blurry; anddetermining the captured image as the to-be-recognized blurry faceimage, in response to the captured image being blurry. Assuming that theforegoing is the first possible implementation manner, in the secondpossible implementation manner provided on the basis of the firstpossible implementation manner, before the step of inputting theto-be-recognized blurry face image into the generator of the trainedgenerative adversarial network to obtain the to-be-recognized clear faceimage, the processor 802 further implements the following steps byexecuting the above-mentioned computer program stored in the storage801:

inputting the blurry face image in each of the clear-blurry face imagepairs in the clear-blurry face image set to a generator of ato-be-trained generative adversarial network to obtain the key points ofthe blurry face image and a generated clear face image;

inputting each of the generated clear face image and the clear faceimage corresponding to the blurry face image to the discriminator of theto-be-trained generative adversarial network to obtain a discriminationresult of the discriminator;

calculating a loss of the discriminator based on the discriminationresult;

inputting the generated clear face image to the feature extractionnetwork to obtain a feature extraction result of the generated clearface image;

inputting the clear face image to the generator and the featureextraction network, respectively, to obtain key points of the clear faceimage and the feature extraction results of the clear face image;

calculating the loss of the generator based on the key points of theblurry face image, the key points of the clear face image, the featureextraction result of the generated clear face image, the featureextraction result of the clear face image, and the discriminationresult; and

optimizing the discriminator based on the loss of the discriminator, andoptimizing the generator based on the loss of the generator until theloss of the generator converges so as to obtain the trained generativeadversarial network.

In the third possible implementation manner provided on the basis of theforegoing second possible implementation manner, the step of calculatingthe loss of the generator based on the key points of the blurry faceimage, the key points of the clear face image, the feature extractionresult of the generated clear face image, the feature extraction resultof the clear face image, and the discrimination result includes stepsof:

calculating an average distance between each key point of the blurryface image and a corresponding key point of the clear face image;

calculating a feature loss value between the feature extraction resultof the generated clear face image and the feature extraction result ofthe clear face image based on a loss function of the feature extractionnetwork;

calculating a cross entropy of the discriminator based on thediscrimination result; an

calculating the loss of the generator based on the average distance, thefeature loss value, and the cross entropy.

In the fourth possible implementation manner provided on the basis ofthe above-mentioned first possible implementation manner, before thestep of inputting the to-be-recognized blurry face image into thegenerator of the trained generative adversarial network to obtain theto-be-recognized clear face image, the processor 802 further implementsthe following steps when executing the above-mentioned computer programstored in the storage 801:

obtaining a sample image containing a clear face;

cropping the sample image based on the clear face to obtain a first faceimage, where the size of the first face image is larger than a presetsize;

reducing the first face image based on a preset interpolation algorithmto obtain a second face image, where the size of the second face imageis equal to the preset size;

reducing the second face image based on the interpolation algorithm toobtain a third face image, where the size of the third face image issmaller than the preset size;

enlarging the third face image based on the interpolation algorithm toobtain a fourth face image, where the size of the fourth face image isequal to the preset size; and

forming the clear-blurry face image pair based on the second face imageand the fourth face image to construct the clear-blurry face image set.

In the fifth possible implementation manner provided on the basis of theforegoing first possible implementation manner, before the step ofmatching the facial feature of the to-be-recognized clear face imagewith each user facial feature in the preset facial feature database, theprocessor 802 further implements the following steps by executing theabove-mentioned computer program stored in the storage 801:

-   -   obtaining a user face image of each user; and

inputting each user face image to the feature extraction network toobtain the user facial feature of each user to construct the facialfeature database.

In the sixth possible implementation manner provided on the basis of theabove-mentioned first possible implementation, the above-mentionedsecond possible implementation, the above-mentioned third possibleimplementation, the above-mentioned fourth possible implementation, orthe above-mentioned fifth possible implementation, the step of matchingthe facial feature of the to-be-recognized clear face image with eachuser facial feature in the preset facial feature database to determinethe user facial feature best matching the to-be-recognized clear faceimage as the target user facial feature includes steps of:

calculating a cosine similarity between the facial feature of theto-be-recognized clear face image and each user facial feature; and

determining the user facial feature corresponding to calculated highestcosine similarity as the target user facial feature.

In the seventh possible implementation manner provided on the basis ofthe foregoing sixth possible implementation manner, the step ofdetermining the user facial feature corresponding to calculated highestcosine similarity as the target user facial feature includes steps of:

comparing the highest cosine similarity with a preset cosine similaritythreshold; and

determining the user facial feature corresponding to the highest cosinesimilarity as the target user facial feature, in response to the highestcosine similarity being greater than the cosine similarity threshold.

The processor 802 may be a central processing unit (CPU), or be othergeneral purpose processor, a digital signal processor (DSP), anapplication specific integrated circuit (ASIC), a field-programmablegate array (FPGA), or be other programmable logic device, a discretegate, a transistor logic device, and a discrete hardware component. Thegeneral purpose processor may be a microprocessor, or the processor mayalso be any conventional processor.

The storage 801 can include read only memory and random access memoryand provides instructions and data to the processor 802. A portion orentire of the storage 801 can also include a non-volatile random accessmemory. For example, the storage 801 can also store information of thedevice type.

It can be seen from the forgoing that, through this embodiment, thegenerative adversarial network pays attention to the facial feature ofthe blurry facial images during training, so that the deblurring processand the recognition process can be organically combined. When thegenerator of the trained generative adversarial network is put into use,the to-be-recognized clear face image generated by the generator basedon the to-be-recognized blurry face can retain the unique featureinformation of the face, which can improve the accuracy of the facerecognition for the to-be-recognized clear face image to a certainextent.

Those skilled in the art may clearly understand that, for theconvenience and simplicity of description, the division of theabove-mentioned functional units and modules is merely an example forillustration. In actual applications, the above-mentioned functions maybe allocated to be performed by different functional units according torequirements, that is, the internal structure of the device may bedivided into different functional units or modules to complete all orpart of the above-mentioned functions. The functional units and modulesin the embodiments may be integrated in one processing unit, or eachunit may exist alone physically, or two or more units may be integratedin one unit. The above-mentioned integrated unit may be implemented inthe form of hardware or in the form of software functional unit. Inaddition, the specific name of each functional unit and module is merelyfor the convenience of distinguishing each other and are not intended tolimit the scope of protection of the present disclosure. For thespecific operation process of the units and modules in theabove-mentioned system, reference may be made to the correspondingprocesses in the above-mentioned method embodiments, and are notdescribed herein.

In the above-mentioned embodiments, the description of each embodimenthas its focuses, and the parts which are not described or mentioned inone embodiment may refer to the related descriptions in otherembodiments.

Those ordinary skilled in the art may clearly understand that, theexemplificative units and steps described in the embodiments disclosedherein may be implemented through electronic hardware or a combinationof computer software and electronic hardware. Whether these functionsare implemented through hardware or software depends on the specificapplication and design constraints of the technical schemes. Thoseordinary skilled in the art may implement the described functions indifferent manners for each particular application, while suchimplementation should not be considered as beyond the scope of thepresent disclosure.

In the embodiments provided by the present disclosure, it should beunderstood that the disclosed apparatus (or device) and method may beimplemented in other manners. For example, the above-mentioned apparatusembodiment is merely exemplary. For example, the division of modules orunits is merely a logical functional division, and other division mannermay be used in actual implementations, that is, multiple units orcomponents may be combined or be integrated into another system, or someof the features may be ignored or not performed. In addition, the shownor discussed mutual coupling may be direct coupling or communicationconnection, and may also be indirect coupling or communicationconnection through some interfaces, devices or units, and may also beelectrical, mechanical or other forms.

The units described as separate components may or may not be physicallyseparated. The components represented as units may or may not bephysical units, that is, may be located in one place or be distributedto multiple network units. Some or all of the units may be selectedaccording to actual needs to achieve the objectives of this embodiment.

When the integrated unit is implemented in the form of a softwarefunctional unit and is sold or used as an independent product, theintegrated unit may be stored in a non-transitory computer-readablestorage medium. Based on this understanding, all or part of theprocesses in the method for implementing the above-mentioned embodimentsof the present disclosure are implemented, and may also be implementedby instructing relevant hardware through a computer program. Thecomputer program may be stored in a non-transitory computer-readablestorage medium, which may implement the steps of each of theabove-mentioned method embodiments when executed by a processor. Inwhich, the computer program includes computer program codes which may bethe form of source codes, object codes, executable files, certainintermediate, and the like. The computer-readable medium may include anyprimitive or device capable of carrying the computer program codes, arecording medium, a USB flash drive, a portable hard disk, a magneticdisk, an optical disk, a computer readable memory, a read-only memory(ROM), a random access memory (RAM), electric carrier signals,telecommunication signals and software distribution media. It should benoted that the content contained in the computer readable medium may beappropriately increased or decreased according to the requirements oflegislation and patent practice in the jurisdiction. For example, insome jurisdictions, according to the legislation and patent practice, acomputer readable medium does not include electric carrier signals andtelecommunication signals.

The above-mentioned embodiments are merely intended for describing butnot for limiting the technical schemes of the present disclosure.Although the present disclosure is described in detail with reference tothe above-mentioned embodiments, it should be understood by thoseskilled in the art that, the technical schemes in each of theabove-mentioned embodiments may still be modified, or some of thetechnical features may be equivalently replaced, while thesemodifications or replacements do not make the essence of thecorresponding technical schemes depart from the spirit and scope of thetechnical schemes of each of the embodiments of the present disclosure,and should be included within the scope of the present disclosure.

What is claimed is:
 1. A computer-implemented face recognition method,comprising steps of: inputting a to-be-recognized blurry face image intoa generator of a trained generative adversarial network to obtain ato-be-recognized clear face image, wherein a training sample of thegenerative adversarial network is obtained from a preset clear-blurryface image set, the clear-blurry face image set comprises one or moreclear-blurry face image pairs, the generator is composed of a key pointdetection encoder and a decoder, and the key point detection encoder isfor detecting key points of the blurry face image inputted to thegenerator; wherein during training the generative adversarial network,an output of the generator is coupled to each of an input of adiscriminator of the generative adversarial network and an input of atrained feature extraction network, and a loss of the generator isassociated with the key point detection encoder, the feature extractionnetwork, and the discriminator; inputting the to-be-recognized clearface image to the feature extraction network to obtain a facial featureof the to-be-recognized clear face image; matching the facial feature ofthe to-be-recognized clear face image with each user facial feature in apreset facial feature database to determine the user facial feature bestmatching the to-be-recognized clear face image as a target user facialfeature; and determining a user associated with the target user facialfeature as a recognition result.
 2. The method of claim 1, whereinbefore the step of inputting the to-be-recognized blurry face image intothe generator of the trained generative adversarial network to obtainthe to-be-recognized clear face image, the method further comprisessteps of: inputting the blurry face image in each of the clear-blurryface image pairs in the clear-blurry face image set to a generator of ato-be-trained generative adversarial network to obtain the key points ofthe blurry face image and a generated clear face image; inputting eachof the generated clear face image and the clear face image correspondingto the blurry face image to the discriminator of the to-be-trainedgenerative adversarial network to obtain a discrimination result of thediscriminator; calculating a loss of the discriminator based on thediscrimination result; inputting the generated clear face image to thefeature extraction network to obtain a feature extraction result of thegenerated clear face image; inputting the clear face image to thegenerator and the feature extraction network, respectively, to obtainkey points of the clear face image and the feature extraction results ofthe clear face image; calculating the loss of the generator based on thekey points of the blurry face image, the key points of the clear faceimage, the feature extraction result of the generated clear face image,the feature extraction result of the clear face image, and thediscrimination result; and optimizing the discriminator based on theloss of the discriminator, and optimizing the generator based on theloss of the generator until the loss of the generator converges so as toobtain the trained generative adversarial network.
 3. The method ofclaim 2, wherein the step of calculating the loss of the generator basedon the key points of the blurry face image, the key points of the clearface image, the feature extraction result of the generated clear faceimage, the feature extraction result of the clear face image, and thediscrimination result comprises steps of: calculating an averagedistance between each key point of the blurry face image and acorresponding key point of the clear face image; calculating a featureloss value between the feature extraction result of the generated clearface image and the feature extraction result of the clear face imagebased on a loss function of the feature extraction network; calculatinga cross entropy of the discriminator based on the discrimination result;and calculating the loss of the generator based on the average distance,the feature loss value, and the cross entropy.
 4. The method of claim 1,wherein before the step of inputting the to-be-recognized blurry faceimage into the generator of the trained generative adversarial networkto obtain the to-be-recognized clear face image, the method furthercomprises steps of: obtaining a sample image containing a clear face;cropping the sample image based on the clear face to obtain a first faceimage, wherein the size of the first face image is larger than a presetsize; reducing the first face image based on a preset interpolationalgorithm to obtain a second face image, wherein the size of the secondface image is equal to the preset size; reducing the second face imagebased on the interpolation algorithm to obtain a third face image,wherein the size of the third face image is smaller than the presetsize; enlarging the third face image based on the interpolationalgorithm to obtain a fourth face image, wherein the size of the fourthface image is equal to the preset size; and forming the clear-blurryface image pair based on the second face image and the fourth face imageto construct the clear-blurry face image set.
 5. The method of claim 1,wherein before the step of matching the facial feature of theto-be-recognized clear face image with each user facial feature in thepreset facial feature database, the method further comprises steps of:obtaining a user face image of each user; and inputting each user faceimage to the feature extraction network to obtain the user facialfeature of each user to construct the facial feature database.
 6. Themethod of claim 1, wherein the step of matching the facial feature ofthe to-be-recognized clear face image with each user facial feature inthe preset facial feature database to determine the user facial featurebest matching the to-be-recognized clear face image as the target userfacial feature comprises steps of: calculating a cosine similaritybetween the facial feature of the to-be-recognized clear face image andeach user facial feature; and determining the user facial featurecorresponding to calculated highest cosine similarity as the target userfacial feature.
 7. The method of claim 6, wherein the step ofdetermining the user facial feature corresponding to calculated highestcosine similarity as the target user facial feature comprises steps of:comparing the highest cosine similarity with a preset cosine similaritythreshold; and determining the user facial feature corresponding to thehighest cosine similarity as the target user facial feature, in responseto the highest cosine similarity being greater than the cosinesimilarity threshold.
 8. The method of claim 1, wherein before the stepof inputting the to-be-recognized blurry face image into the generatorof the trained generative adversarial network to obtain theto-be-recognized clear face image, the method further comprises stepsof: capturing an image of a to-be-recognized face through a camera;detecting the quality of the captured image based on a preset qualitydetection model to determine whether the captured image is blurry; anddetermining the captured image as the to-be-recognized blurry faceimage, in response to the captured image being blurry.
 9. A facerecognition apparatus, comprising: a memory; a processor; and one ormore computer programs stored in the memory and executable on theprocessor, wherein the one or more computer programs comprise:instructions for inputting a to-be-recognized blurry face image into agenerator of a trained generative adversarial network to obtain ato-be-recognized clear face image, wherein a training sample of thegenerative adversarial network is obtained from a preset clear-blurryface image set, the clear-blurry face image set comprises one or moreclear-blurry face image pairs, the generator is composed of a key pointdetection encoder and a decoder, and the key point detection encoder isfor detecting key points of the blurry face image inputted to thegenerator; wherein during training the generative adversarial network,an output of the generator is coupled to each of an input of adiscriminator of the generative adversarial network and an input of atrained feature extraction network, and a loss of the generator isassociated with the key point detection encoder, the feature extractionnetwork, and the discriminator; instructions for inputting theto-be-recognized clear face image to the feature extraction network toobtain a facial feature of the to-be-recognized clear face image;instructions for matching the facial feature of the to-be-recognizedclear face image with each user facial feature in a preset facialfeature database to determine the user facial feature best matching theto-be-recognized clear face image as a target user facial feature; andinstructions for determining a user associated with the target userfacial feature as a recognition result.
 10. The apparatus of claim 9,wherein the one or more computer programs further comprise: instructionsfor inputting the blurry face image in each of the clear-blurry faceimage pairs in the clear-blurry face image set to a generator of ato-be-trained generative adversarial network to obtain the key points ofthe blurry face image and a generated clear face image; instructions forinputting each of the generated clear face image and the clear faceimage corresponding to the blurry face image to the discriminator of theto-be-trained generative adversarial network to obtain a discriminationresult of the discriminator; instructions for calculating a loss of thediscriminator based on the discrimination result; instructions forinputting the generated clear face image to the feature extractionnetwork to obtain a feature extraction result of the generated clearface image; instructions for inputting the clear face image to thegenerator and the feature extraction network, respectively, to obtainkey points of the clear face image and the feature extraction results ofthe clear face image; instructions for calculating the loss of thegenerator based on the key points of the blurry face image, the keypoints of the clear face image, the feature extraction result of thegenerated clear face image, the feature extraction result of the clearface image, and the discrimination result; and instructions foroptimizing the discriminator based on the loss of the discriminator, andoptimizing the generator based on the loss of the generator until theloss of the generator converges so as to obtain the trained generativeadversarial network.
 11. The apparatus of claim 10, wherein theinstructions for calculating the loss of the generator based on the keypoints of the blurry face image, the key points of the clear face image,the feature extraction result of the generated clear face image, thefeature extraction result of the clear face image, and thediscrimination result comprise: instructions for calculating an averagedistance between each key point of the blurry face image and acorresponding key point of the clear face image; instructions forcalculating a feature loss value between the feature extraction resultof the generated clear face image and the feature extraction result ofthe clear face image based on a loss function of the feature extractionnetwork; instructions for calculating a cross entropy of thediscriminator based on the discrimination result; and instructions forcalculating the loss of the generator based on the average distance, thefeature loss value, and the cross entropy.
 12. The apparatus of claim 9,wherein the one or more computer programs further comprise: instructionsfor obtaining a sample image containing a clear face; instructions forcropping the sample image based on the clear face to obtain a first faceimage, wherein the size of the first face image is larger than a presetsize; instructions for reducing the first face image based on a presetinterpolation algorithm to obtain a second face image, wherein the sizeof the second face image is equal to the preset size; instructions forreducing the second face image based on the interpolation algorithm toobtain a third face image, wherein the size of the third face image issmaller than the preset size; instructions for enlarging the third faceimage based on the interpolation algorithm to obtain a fourth faceimage, wherein the size of the fourth face image is equal to the presetsize; and instructions for forming the clear-blurry face image pairbased on the second face image and the fourth face image to constructthe clear-blurry face image set.
 13. The apparatus of claim 9, whereinthe one or more computer programs further comprise: instructions forobtaining a user face image of each user; and instructions for inputtingeach user face image to the feature extraction network to obtain theuser facial feature of each user to construct the facial featuredatabase.
 14. The apparatus of claim 9, wherein the instructions formatching the facial feature of the to-be-recognized clear face imagewith each user facial feature in the preset facial feature database todetermine the user facial feature best matching the to-be-recognizedclear face image as the target user facial feature comprise:instructions for calculating a cosine similarity between the facialfeature of the to-be-recognized clear face image and each user facialfeature; and instructions for determining the user facial featurecorresponding to calculated highest cosine similarity as the target userfacial feature.
 15. The apparatus of claim 14, wherein the instructionsfor determining the user facial feature corresponding to calculatedhighest cosine similarity as the target user facial feature comprise:instructions for comparing the highest cosine similarity with a presetcosine similarity threshold; and instructions for determining the userfacial feature corresponding to the highest cosine similarity as thetarget user facial feature, in response to the highest cosine similaritybeing greater than the cosine similarity threshold.
 16. The apparatus ofclaim 9, wherein the face recognition apparatus further comprises acamera, and the one or more computer programs further comprise:instructions for capturing an image of a to-be-recognized face through acamera; instructions for detecting the quality of the captured imagebased on a preset quality detection model to determine whether thecaptured image is blurry; and instructions for determining the capturedimage as the to-be-recognized blurry face image, in response to thecaptured image being blurry.
 17. A non-transitory computer-readablestorage medium storing one or more computer programs executable on aprocessor to implement a face recognition method, wherein the one ormore computer programs comprise: instructions for inputting ato-be-recognized blurry face image into a generator of a trainedgenerative adversarial network to obtain a to-be-recognized clear faceimage, wherein a training sample of the generative adversarial networkis obtained from a preset clear-blurry face image set, the clear-blurryface image set comprises one or more clear-blurry face image pairs, thegenerator is composed of a key point detection encoder and a decoder,and the key point detection encoder is for detecting key points of theblurry face image inputted to the generator; wherein during training thegenerative adversarial network, an output of the generator is coupled toeach of an input of a discriminator of the generative adversarialnetwork and an input of a trained feature extraction network, and a lossof the generator is associated with the key point detection encoder, thefeature extraction network, and the discriminator; instructions forinputting the to-be-recognized clear face image to the featureextraction network to obtain a facial feature of the to-be-recognizedclear face image; instructions for matching the facial feature of theto-be-recognized clear face image with each user facial feature in apreset facial feature database to determine the user facial feature bestmatching the to-be-recognized clear face image as a target user facialfeature; and instructions for determining a user associated with thetarget user facial feature as a recognition result.
 18. The storagemedium of claim 17, wherein the one or more computer programs furthercomprise: instructions for inputting the blurry face image in each ofthe clear-blurry face image pairs in the clear-blurry face image set toa generator of a to-be-trained generative adversarial network to obtainthe key points of the blurry face image and a generated clear faceimage; instructions for inputting each of the generated clear face imageand the clear face image corresponding to the blurry face image to thediscriminator of the to-be-trained generative adversarial network toobtain a discrimination result of the discriminator; instructions forcalculating a loss of the discriminator based on the discriminationresult; instructions for inputting the generated clear face image to thefeature extraction network to obtain a feature extraction result of thegenerated clear face image; instructions for inputting the clear faceimage to the generator and the feature extraction network, respectively,to obtain key points of the clear face image and the feature extractionresults of the clear face image; instructions for calculating the lossof the generator based on the key points of the blurry face image, thekey points of the clear face image, the feature extraction result of thegenerated clear face image, the feature extraction result of the clearface image, and the discrimination result; and instructions foroptimizing the discriminator based on the loss of the discriminator, andoptimizing the generator based on the loss of the generator until theloss of the generator converges so as to obtain the trained generativeadversarial network.
 19. The storage medium of claim 18, wherein theinstructions for calculating the loss of the generator based on the keypoints of the blurry face image, the key points of the clear face image,the feature extraction result of the generated clear face image, thefeature extraction result of the clear face image, and thediscrimination result comprise: instructions for calculating an averagedistance between each key point of the blurry face image and acorresponding key point of the clear face image; instructions forcalculating a feature loss value between the feature extraction resultof the generated clear face image and the feature extraction result ofthe clear face image based on a loss function of the feature extractionnetwork; instructions for calculating a cross entropy of thediscriminator based on the discrimination result; and instructions forcalculating the loss of the generator based on the average distance, thefeature loss value, and the cross entropy.
 20. The storage medium ofclaim 17, wherein the one or more computer programs further comprise:instructions for obtaining a sample image containing a clear face;instructions for cropping the sample image based on the clear face toobtain a first face image, wherein the size of the first face image islarger than a preset size; instructions for reducing the first faceimage based on a preset interpolation algorithm to obtain a second faceimage, wherein the size of the second face image is equal to the presetsize; instructions for reducing the second face image based on theinterpolation algorithm to obtain a third face image, wherein the sizeof the third face image is smaller than the preset size; instructionsfor enlarging the third face image based on the interpolation algorithmto obtain a fourth face image, wherein the size of the fourth face imageis equal to the preset size; and instructions for forming theclear-blurry face image pair based on the second face image and thefourth face image to construct the clear-blurry face image set.